<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('上级不同意退回工单M')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            工单编号：<input type="text" name="workFormNo"/>
                        </li>
                        <li>
                            派发单位：<input type="text" name="sdeptName"/>
                        </li>

                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm " id="toolbar" role="group">
            <a class="btn btn-success single disabled" onclick="$.operate.handleTab()">
                <i class="fa"></i> 处理
            </a>
            <a class="btn btn-success multiple disabled" onclick="printTransferBill()">
                <i class="fa fa-print"></i> 转办单
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:src="@{/common/js/common.js}"></script>
<script th:inline="javascript">
    var prefix = ctx + "system/mMailWF";
    var mInterior = ctx + "system/mInterior";
    $(function () {
        var options = {
            url: prefix + "/cmnFile/rNotPassListJson",
            sortName: "pkId",
            sortOrder: "desc",
            uniqueId: "myPkVal",
            updateUrl:  ctx+"system/cmnTab/mwfCSignS/{id}",
            modalName: "上级不同意退回工单",
            fixedColumns: true,
            fixedNumber: 2,
            fixedRightNumber: 1,
            rowStyle: rowStyle,
            columns: [{
                checkbox: true
            },
                {field:'myPkVal',title:'pkid',visible:false},
                {field:'WfId',title:'WfId',visible:false},
                {field:'myMwfNO',title:'工单编号',align:'center'},
                {field:'SpareString',title:'信件来源',align:'center',sortable:true},
                {field:'myMwfTopic',title:'工单主题',align:'center',
                    formatter:function (value, row, index,field) {
                        var obj = rowStyle(row)
                        if(obj == '')
                            return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                        if(obj.css.color == 'blue')
                            return "<span style='cursor: pointer;color: blue;font-weight: bold;' title='"+value+"'>"+value+"</span>"
                        else if(obj.css.color == 'red')
                            return "<span style='cursor: pointer;color: red;font-weight: bold;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis
                },
                {field:'SeqName',title:'交办次序',align:'center',sortable:true},
                {field:'SortName',title:'性质',align:'center',sortable:true},
                {field:'DealName',title:'办理方式',align:'center',sortable:true},
                {field:'bkLimit',title:'办理期限',align:'center'},
                {field:'SDeptName',title:'派发单位',align:'center',sortable:true},
                {field:'sdDate',title:'派发日期',align:'center'},
                {field:'SendRemark',title:'备注',align:'center',
                    formatter:function (value, row, index,field) {
                        return "<span style='cursor: pointer;' title='"+value+"'>"+value+"</span>"
                    },
                    cellStyle: cellEllipsis
                },
                {field:'FlagString',title:'转办情况',align:'center',sortable:true},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.handleTab(\'' + row.myPkVal + '\',\'电话工单签收处理\')"><i class="fa"></i>处理</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    function printTransferBill() {
        var url = prefix+"/forShow/printSends";
        let row = $("#bootstrap-table").bootstrapTable('getSelections');
        if (row.length < 2) {
            url += "?ids="+row[0].myPkVal;
        }else {
            var ids = '';
            for (let i = 0; i < row.length; i++) {
                ids += row[i].myPkVal;
                if ((i+1) != row.length) {
                    ids += ","
                }
            }
            url += "?ids="+ids;
        }
        window.open(url,"printTransferBill",'left=100,top=20,height=700,width=720,toolbar=yes,menubar=yes,scrollbars=auto');

    }
</script>
</body>
</html>